import Vue from 'vue'
import VueRouter from 'vue-router'

// 一级
import login from '@/views/login'
import register from '@/views/register'
import layout from '@/views/layout'
// 二级
import home from '@/views/home'
import artCate from '@/views/artCate'
import artList from '@/views/artList'
import userInfo from '@/views/userInfo'
import userAvatar from '@/views/userAvatar'
import userPwd from '@/views/userPwd'

Vue.use(VueRouter)

const routes = [
  { path: '/login', component: login },
  { path: '/register', component: register },
  {
    path: '/layout',
    component: layout,
    children: [
      { path: '/', redirect: '/home' },
      { path: '/home', component: home },
      { path: '/art-cate', component: artCate },
      { path: '/art-list', component: artList },
      { path: '/user-info', component: userInfo },
      { path: '/user-avatar', component: userAvatar },
      { path: '/user-pwd', component: userPwd }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
